feat: add fix-signature subcommand for externally signed bundles#220
Open
bryan-anthropic wants to merge 1 commit intomainfrom
Open
feat: add fix-signature subcommand for externally signed bundles#220bryan-anthropic wants to merge 1 commit intomainfrom
bryan-anthropic wants to merge 1 commit intomainfrom
Conversation
Enterprise HSM signers (GaraSign, SignServer, Venafi, Azure SignTool) append PKCS#7 signatures after the ZIP EOCD without updating comment_length. Claude Desktop's adm-zip parser rejects these files. PR #204 fixed this for `mcpb sign` but external signers remain broken. This adds `mcpb fix-signature` which applies the same EOCD fix post-hoc, so enterprises can add one step to their signing pipeline. Validated end-to-end with Autodesk's GaraSign-signed Fusion MCPB: - adm-zip, unzip, Python zipfile all accept the fixed bundle - Claude Desktop installs it successfully - Signature bytes (MCPB_SIG_V1 + PKCS#7 + MCPB_SIG_END) remain intact - Exactly 2 bytes changed (EOCD comment_length field) Relates to #204, #21, #194 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.
Once credits are available, reopen this pull request to trigger a review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enterprise HSM signers (GaraSign, SignServer, Venafi, Azure SignTool) append PKCS#7 signatures after the ZIP EOCD without updating
comment_length. Claude Desktop'sadm-zipparser strictly validates this field and rejects signed bundles with:PR #204 fixed this for
mcpb sign, but external signers don't do ZIP surgery — and arguably shouldn't need to. This PR addsmcpb fix-signatureas a post-signing fixup step that any enterprise can add to their pipeline.What it does
mcpb fix-signature <bundle.mcpb>sets the ZIP EOCDcomment_lengthfield to encompass the trailing signature bytes. This makes the file a spec-valid ZIP (signature lives in the ZIP comment field) while preserving the signature intact.findEocdOffset()andextractSignatureBlock()fromsign.ts— no new ZIP parsing codemcpb sign(comment_length already correct)Validation
Tested end-to-end with a GaraSign-signed MCPB:
adm-zip(Claude Desktop)unzip -tzipfileMCPB_SIG_V1+ PKCS#7 +MCPB_SIG_ENDunchangedPrior art
No other signed-ZIP format appends after EOCD without owning the signing pipeline:
.sigzipsidecarThis subcommand bridges the gap until a signer-friendly format lands in Signatures V2.
Usage
Test plan
sign.e2e.test.ts(222 total, all passing)comment_lengthmcpb signadm-zipvalidation of fixed bundleRelates to #204, #21, #194
🤖 Generated with Claude Code